package com.xikeda.controller;

import com.xikeda.model.DeliveryTable;

import com.xikeda.service.imp.ExpressdeliveryService;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.List;

/**
 * @Author Xiao Linqing
 * @date 2020/6/6 13:17
 */
@Controller
public class ExpressdeliveryController {
    @Resource
    private ExpressdeliveryService expressdeliveryService;
    public ExpressdeliveryService getExpressdeliveryService() {
        return expressdeliveryService;
    }
    @Autowired
    public void setExpressdeliveryService(ExpressdeliveryService expressdeliveryService) {
        this.expressdeliveryService = expressdeliveryService;
    }
    @RequestMapping("/findcourierid")
    @ResponseBody
    public String Inquiry3(HttpServletRequest request,HttpServletResponse  response)throws Exception{
        String telephone=request.getParameter("telephone");
        int id1=expressdeliveryService.findcourierid(telephone);
        System.out.println(id1);
        return "demo";
    }
    @RequestMapping("/finddeliveryexpress")
    @ResponseBody
    public String delivery1(HttpServletRequest request, HttpServletResponse response) throws Exception{
        String courier_id=request.getParameter("courier_id");
        System.out.println(courier_id);
        List<DeliveryTable> list=this.getExpressdeliveryService().Finddeliverygoods(courier_id);
            if(list!=null&&list.size()>0){
            for(DeliveryTable i:list){
                System.out.println(i.getCommodity_name());
                System.out.println(i.getUser_id());
            }
        }
        return "demo";
    }
    @RequestMapping("test5")
    public String InquiryExpress1(HttpServletRequest request, HttpServletResponse response){
        return "demo";
    }
}
